<template>
  <div class="app">
    <h2>我是App组件</h2>
    <h3>儿子给我的玩具：{{ wanju }}</h3>
    <h3>儿子给我的电脑：{{diannao}}</h3>
    <h3>儿子给我的手机：{{shouji}}</h3>
    <Child @send-toy="getToy" @send-computer="getComputer" @send-phone="getPhone"/>
  </div>
</template>

<script>
  import Child from './components/Child.vue'

  export default {
    name:'App',
    components:{Child},
    data() {
      return {
        wanju:'',
        diannao:'',
        shouji:''
      }
    },
    methods: {
      getToy(value){
        console.log('App',value)
        this.wanju = value
      },
      getComputer(value){
        this.diannao = value
      },
      getPhone(value){
        this.shouji = value
      }
    }
  }
</script>

<style>
  .app {
    background-color: #ddd;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 10px;
  }
</style>